<?php
class JYDep {
	const table = 'DEP';
	const pk = 'DEP_ID';
	
	public static function getZyDepts($unitId) {
		$where = 'DEP_TYPE=2';  //兼容超级管理员查看
		if(CSM_UNIT_ID>0){
			$where .= ' and unit_id='.$unitId;
		}
		return JYDB::findAll(self::table, $where, "DEP_NAME, DEP_ID, DEP_SPELL, DEP_NO");
	}
	
	public static function getMzDepts($unitId) {
		$where = 'DEP_TYPE=1'; //兼容超级管理员查看
		if(CSM_UNIT_ID>0){
			$where .= ' and unit_id='.$unitId;
		}
		return JYDB::findAll(self::table,$where, "DEP_NAME, DEP_ID, DEP_SPELL, DEP_NO");
	}
	
	public static function getAllDepts($unid){
		$where = '1=1'; //兼容超级管理员查看
		if(CSM_UNIT_ID>0){
			$where .= ' and unit_id='.$unid;
		}
		return JYDB::findAll(self::table,$where, "DEP_NAME, DEP_ID, DEP_SPELL, DEP_NO");
	}
}